#pragma once
#include <stack>
#include <stdlib.h>
#include "AdderBytecodeEngine.h"

class AdderVariableScoper
{
public:
	AdderVariableScoper(unsigned int scope_size);
	~AdderVariableScoper(void);

	void** scopes[1000];
	int scope_level;
	int allocated_scopes;
	void** current_scope;

	AdderValue* operator [](unsigned int n);
	void set(unsigned int n, AdderValue* t);
	unsigned int size();
	unsigned int level();
	bool exists(unsigned int n);
	void erase(unsigned int n);
	void raise();
	void lower();
	void clear();

private:
	unsigned long hash(unsigned char *str);
	void _allocate_scope();
	void _deallocate_scope();
	void _clear_scope();

	// Never ever EVER change this after the variable scoper has been created!
	unsigned int SCOPE_SIZE;

};
